package treemap;

import java.text.Collator;
import java.util.Arrays;
import java.util.Locale;

public class Demo04 {
    public static void main(String[] args) {
        String[] names= {"赵z子z龙l","刘l备b","关g羽y","张z飞f"};
        System.out.println("排序前"+ Arrays.toString(names));

        Collator cpt = Collator.getInstance(Locale.CHINA);
        Arrays.sort(names, cpt);

        /*

        Collator其实就是  Comparator的实例  人家写好的中文排序规则

        Arrays.sort(names, new Comparator<String>() {
            @Override
            public int compare(String o1, String o2) {
                return 0;
            }
        });

         */
        System.out.println("排序后"+Arrays.toString(names));
    }
}
